<%-- 
    Document   : newjsp
    Created on : Dec 6, 2012, 11:09:57 PM
    Author     : harker777
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Stations list</title>
        <link href="css/stations.css" rel="stylesheet" type="text/css">
        <link href="css/tables.css" rel="stylesheet" type="text/css">
        <link href="css/header.css" rel="stylesheet" type="text/css">
        <link href="css/common.css" rel="stylesheet" type="text/css">
        <link href="css/menu.css" rel="stylesheet" type="text/css">
    </head>
    <body>
        <%@include file="header.jsp" %> </%@include>
        <%@include file="menu.jsp" %> </%@include>
        <div class="maincontent">
            <form method="POST">
                <input type="hidden" name="action" value="addstation" />
                <input type="submit" value="Add station" class="button" 
                       style="width: 200px;" />
            </form>
            <table class="entitytable" id="stationstable">
                <thead>
                    <tr>
                        <td> Id </td>
                        <td> Name </td>
                        <c:forEach items="${types}" var="type">
                            <td>
                                <c:out value="${type.name}"> </c:out>
                            </td>
                        </c:forEach>
                        <td>  </td>
                        <td>  </td>
                        <td>  </td>
                    </tr>
                </thead>
                <c:forEach items="${stations}" var="station">
                    <tr>
                        <td width="30px">
                            <c:out value="${station.id}"> </c:out>
                        </td>
                        <td>
                            <c:out value="${station.name}"> </c:out>
                        </td>
                        <c:forEach items="${station.typesList}" var="type">
                            <td width="100px">
                                <c:if test="${type.status eq 'true'}">yes</c:if>
                                <c:if test="${type.status eq 'false'}">no</c:if>
                            </td>
                        </c:forEach>
                        <td class="with_button">
                            <form method="POST">
                                <input type="hidden" name="action" value="deletestation">
                                <input type="hidden" name="id" value="${station.id}">
                                <input type="submit" value="X" class="some_but del_but">
                            </form>
                        </td>
                        <td class="with_button">
                            <form method="GET" target="_blank" action="http://maps.google.com/maps">
                                <input type="hidden" name="q" value="${station.lattitude} ${station.longitude}">
                                <input type="hidden" name="z" value="17">
                                <input type="hidden" name="via" value="0">
                                <input type="submit" value="M" class="some_but map_but" >
                            </form>
                        </td>
                        <td class="with_button">
                            <form method="POST">
                                <input type="hidden" name="action" value="editstation">
                                <input type="hidden" name="id" value="${station.id}">
                                <input type="submit" value="E" class="some_but edit_but">
                            </form>
                        </td>                        
                    </tr>
                </c:forEach>
            </table>
        </div>

    </body>
</html>
